package cn.adkii.springframework.context.event;

import cn.adkii.springframework.beans.factory.BeanFactory;
import cn.adkii.springframework.context.ApplicationListener;

/**
 * @author malingdi
 * @description Simple implementation of the {@link ApplicationEventMulticaster} interface
 * @date 2023/11/28 16:03
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster{

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)){
            listener.onApplicationEvent(event);
        }
    }
}
